package cn.lyd.vo;

import cn.lyd.enums.MyEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResults {

    private static final String successMsg="操作成功";
    private static final String successCode="1000";
    private static final String failMsg="操作失败";
    private static final String failCode="10001";

    private String code;
    private String msg;
    private Object object;

    public static AjaxResults newAjaxResults(String code, String msg, Object object) {
        return new AjaxResults(code,msg,object);
    }


    public static AjaxResults EnumAjaxResults(MyEnum myEnum,Object object) {
        return new AjaxResults(myEnum.getCode(),myEnum.getMsg(),object);
    }


    public  static AjaxResults success(Object object) {
        return new AjaxResults(successCode,successMsg,object);
    }
    public static  AjaxResults fail(Object object) {
        return new AjaxResults(failCode,failMsg,object);
    }

}